﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EIA.Basic.Model;
using EIA.Basic.BLL;

namespace EIA.Basic.ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {

            List<TPosition> l = new List<TPosition>();
            l.Add(new TPosition() { PosLevel = 1, PosName = "zhiyuan" });
            l.Add(new TPosition() { PosLevel = 1, PosName = "jingli" });
            string str = Newtonsoft.Json.JsonConvert.SerializeObject(l);
            Console.WriteLine(str);
            l = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TPosition>>(str);

            XStaffBlp stfBlp = new XStaffBlp();
            IList<Tuple<TStaff, TUser>> list = stfBlp.List(null, 20, 1);
            if (list == null || list.Count == 0)
            {
                stfBlp.Insert(new Tuple<TStaff, TUser>(new TStaff() { StfName = "王斌", ContactTel = "13675889010", IsActive = 1 }, new TUser() { LoginId = "admin", LoginPwd = "admin", LoginAvalible = 1 }));

                stfBlp.Insert(new Tuple<TStaff, TUser>(new TStaff() { StfName = "王小二", ContactTel = "13901234567", IsActive = 1 }, new TUser() { LoginId = "user", LoginPwd = "user", LoginAvalible = 1 }));

                list = stfBlp.List(null, 20, 1);
            }
            foreach (var i in list)
            {
                Console.WriteLine(i.Item1.StfName + ":" + i.Item1.ContactTel + ":" + i.Item2.LoginId);

            }
            Console.ReadKey();
        }
    }
}
